﻿@using PagedList.Mvc;
@model PagedList.IPagedList<OT.Areas.Admin.Models.Languages>

@{
    ViewBag.Title = "Index";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
<div id="notice" class="popup_error"></div>
<h2>Language</h2>
<p>
    @Html.ActionLink("Create New", "Create")
</p>

@using (Html.BeginForm("Index", "Language", FormMethod.Get)) {
     @Html.TextBox("SearchString", ViewBag.CurrentFilter as string)
    <div class="btn-group pull-left">

        <input class="btn dropdown-toggle" type="submit" value="Search" />
    </div>
}
<table style="width:100%;">
    <tr>
        <th>
            @Html.ActionLink("LanguageCode", "Index", new { sortOrder = ViewBag.NameSortParm, currentFilter = ViewBag.CurrentFilter, filedName = "LanguageCode" })
        </th>
        <th>
            @Html.ActionLink("LanguageName", "Index", new { sortOrder = ViewBag.NameSortParm, currentFilter = ViewBag.CurrentFilter, filedName = "LanguageName" })
        </th>
       <th>
            @Html.ActionLink("Description", "Index")
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.LanguageCode)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.LanguageName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Description)
        </td>
        <td>
                @Html.ActionLink("  ", "Edit", new { item.LanguageID }, new { CLASS="icon-edit" }) |
            @Html.ActionLink("  ", "Delete", new { item.LanguageID }, new { @onclick = "javascript:return confirm('Do you want to delete ?')" ,CLASS="icon-remove-sign" })
            </td>
    </tr>
}

</table>
Total Language: @(Model.TotalItemCount)
@Html.PagedListPager(Model, page => Url.Action("Index",
    new { page, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter }))

@section scripts{
      @Scripts.Render("~/bundles/jqueryui")
    <script type="text/javascript">
        $(document).ready(function () {
       
            var notice = '@TempData["notice"]';
            if (notice != '' || notice != undefined || notice != null) {
                $('#notice').show();
                $('#notice').html(notice);
                setTimeout("$('#notice').hide(); ", 3000); //display message for 3 seconds
            }
            else {
                $('#notice').hide();
            }
        });
    </script>
}